package com.lyf.common.utils;

import com.lyf.common.constant.Constant;

/**
 * @author ASUS
 * @Classname CommonUtil
 * @Description TODO
 * @Date 2021/7/25 13:55
 */
public class CommonUtil {
    /**
     * 当前页
     *
     * @param pageNum
     * @return
     */
    public static Integer validPageNum(Integer pageNum) {
        if (pageNum == null) {
            return 1;
        }
        if (pageNum <= 0) {
            return 1;
        }
        return pageNum;
    }

    public static Integer validPageSize(Integer pageSize) {
        if (pageSize == null) {
            return 10;
        }
        if (pageSize <= 0) {
            return 10;
        }
        if (pageSize > Constant.MAX_BATCH_SIZE) {
            return 200;
        }
        return pageSize;
    }
}
